#include <AppModel\Include\Torus.h>

using namespace AppModel;

 // ========== LIFECYCLE ========== //

Torus::Torus(Render::Mesh* mesh, Render::Texture* texture)
{
    this->mesh = mesh;
    this->texture = texture;
    this->mesh_wave_offset = 0.0f;
    this->mesh_wave_velocity = 1.0f;
}

Torus::~Torus(void)
{
}

// ========== OVERLODED OPERATORS ========== //

// ========== METHODS ========== //
void Torus::progress(const float &time_step_ms)
{
    float delta_wave = time_step_ms * this->mesh_wave_velocity * 0.001f;
    this->mesh_wave_offset += delta_wave;
    /// clamp the offset between 0 and 2*PI
    if (this->mesh_wave_offset > 3.14159f * 2.0f)
    {
        this->mesh_wave_offset -= 3.14159f * 2.0f;
    }
}

void Torus::changeResources(Render::Mesh* mesh, Render::Texture* texture)
{
    this->mesh = mesh;
    this->texture = texture;
}

// ========== GETTERS ========== //
Render::Mesh* Torus::getMesh() const
{
    return this->mesh;
}
Render::Texture* Torus::getTexture() const
{
    return this->texture;
}

float Torus::getWaveOffset() const
{
    return this->mesh_wave_offset;
}

// ========== SETTERS ========== //
void Torus::setWaveVelocity(float velocity)
{
    this->mesh_wave_velocity = velocity;
}

// ========== INQUIRY ========== //
